package com.longcai.util;

import org.apache.http.HttpHost;
import org.apache.http.HttpRequest;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.conn.ClientConnectionManager;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.params.HttpParams;
import org.apache.http.protocol.HttpContext;

import java.io.IOException;

@SuppressWarnings("deprecation")
public class CloseableHttpClientWapper extends CloseableHttpClient{

	private CloseableHttpClient client;

	public CloseableHttpClientWapper(CloseableHttpClient client) {
		this.client = client;
	}

	@Override
	public ClientConnectionManager getConnectionManager() {
		return client.getConnectionManager();
	}

	@Override
	public HttpParams getParams() {
		return client.getParams();
	}

	@Override
	public void close() throws IOException {
		
	}

	@Override
	protected CloseableHttpResponse doExecute(HttpHost target, HttpRequest request, HttpContext context)
			throws IOException {
		return client.execute(target, request, context);
	}

	public CloseableHttpClient getRealClient() {
		return client;
	}

}
